
//键盘事件
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import static java.lang.Thread.sleep;
public class Test03 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        //回车
        webDriver.findElement(By.cssSelector("#kw")).sendKeys("大海");
        webDriver.findElement(By.cssSelector("#kw")).sendKeys(Keys.ENTER);
        sleep(3000);
        //c+A
        webDriver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL+"A");
        sleep(2000);
        //c+x
        webDriver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL+"X");
        sleep(2000);
        //c+V
        webDriver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL+"V");
        sleep(2000);
        webDriver.close();
    }
}
